import request from '@/utils/request'

// 查询分类列表
export function listMaterial(query) {
  return request({
    url: 'inv/items/list',
    method: 'get',
    params: query
  })
}

// 新增物料
export function addMaterial(data) {
  return request({
    url: '/inv/items/add',
    method: 'post',
    data: data
  })
}

// 清空当前分类物料
export function emptyMaterial(sortId) {
 return request({
    url: '/inv/items/all/' + sortId,
    method: 'delete'
  })
}

// 修改物料
export function updateMateria(data) {
  return request({
    url: '/inv/items/edit',
    method: 'put',
    data: data
  })
}

// 查看物料
export function seeMaterial(uniqueId) {
  return request({
    url: '/inv/items/' + uniqueId,
    method: 'get'
  })
}

// 删除物料
export function deleteMaterial(code) {
  return request({
    url: '/inv/items/' + code,
   method: 'delete'
  })
}

// 查询计量单位
export function listUnit(query) {
  return request({
    url: 'inv/unit/list',
    method: 'get',
    params: query
  })
}

// 查询包装单位
export function listPkg(query) {
  return request({
    url: 'inv/package/list',
    method: 'get',
    params: query
  })
}

// 导出物料
export function exportMaterial(query) {
  return request({
    url: '/inv/items/export',
    method: 'get',
    params: query
  })
}

// 下载物料导入模板
export function importMateria(query) {
  return request({
    url: '/inv/items/importTemplate',
    method: 'get',
     params: query
  })
}


//字典
export function dictMatching (data) {
  return request({
    url: '/system/dict/data/type/'+ data,
    method: 'get',
  })
}

//模块参数
export function moduleParameters(query) {
  return request({
    url: '/system/config/list',
    method: 'get',
    params: query
  })
}

// 农药基本档导出
export function exportRelatedMaterial(query) {
  return request({
    url: '/inv/items/export/tc',
    method: 'get',
    params: query
  })
}

// 成品基本档导出
export function exportMachiningMaterial(query) {
  return request({
    url: '/inv/items/export/mach',
    method: 'get',
    params: query
  })
}